import '../../../model/key_value_model.dart';

/// FileName search_result_model
///
/// @Author lax
/// @Date 2023/5/16
///
/// @Description

class SearchResultModel {
  /// 搜索按钮数据
  KeyValueModel? buttonModel;

  /// 选中的数据
  List<KeyValueModel>? selectedList;

  /// 选中的id
  String? get selectedKey {
    final list = selectedList ?? [];
    if (list.isEmpty) {
      return null;
    }
    return list.map((e) => e.key).toList().join(',');
  }

  /// 选中的名称
  String? get selectedValue {
    final list = selectedList ?? [];
    if (list.isEmpty) {
      return null;
    }
    return list.map((e) => e.value).toList().join(', ');
  }

  SearchResultModel({
    this.buttonModel,
    this.selectedList,
  });
}
